<template>
  <div class="newUserSelect">
    <div class="page-header">
      <div>恭喜，您的智联同城账号已注册</div>
      <!-- <div>您可以通过手机号<span>{{loginInfor.mobile}}</span>进行登录</div> -->
    </div>

    <div class="page-cont">
      <div class="page-cont-hint">
        <div>选一个产品，马上使用</div>
        <div>以下产品，均可以在企业中心免费体验</div>
      </div>
      <div class="select-product">
        <div class="select-title">
          热门推荐 <span>Popular recommend</span>
        </div>
        <div class="hot-cont">
          <template v-for="(item, index) in hotPro">
            <div :key="index" :style="{'backgroundImage': `url(${item.imgUrl})`}" @click="selectId = item.id">
              <div class="select-module" v-if="item.id == 2">
                <i class="el-icon-success" :style="{color:selectId == item.id?'#0076fe':'#e9eaed' }"></i>
              </div>
            </div>
          </template>
        </div>

        <div class="select-title ">
          电商零售 <span>E-commerce&retail</span>
        </div>
        <div class="hot-cont commerce-retail">
          <template v-for="(item, index) in retailData">
            <div :key="index" class="module-box" @click="selectId = item.id">
              <!-- <div class="select-module">
                <i class="el-icon-success" :style="{color:selectId == item.id?'#0076fe':'#e9eaed' }"></i>
              </div> -->
              <div class="module-box-introduce">
                <div class="name">
                  <span>{{ item.title }}</span>
                  <img :src="item.imgUrl"/>
                </div>
                <div class="module-hint">{{ item.hint }}</div>
              </div>
              <div class="module-button">
                <el-button type="text">立即创建</el-button>
              </div>
            </div>
          </template>
        </div>

        <div class="select-title ">
          营销推广 <span>Marketing&Promotion</span>
        </div>
        <div class="hot-cont commerce-retail">
          <template v-for="(item, index) in generalize">
            <div :key="index" class="module-box" @click="selectId = item.id" >
              <!-- <div class="select-module">
                <i class="el-icon-success" :style="{color:selectId == item.id?'#0076fe':'#e9eaed' }"></i>
              </div> -->
              <div class="module-box-introduce">
                <div class="name">
                  <span>{{ item.title }}</span>
                  <img :src="item.imgUrl"/>
                </div>
                <div class="module-hint">{{ item.hint }}</div>
              </div>
              <div class="module-button">
                <el-button type="text">立即创建</el-button>
              </div>
            </div>
          </template>
        </div>
      </div>

      <div class="select-function" v-if="selectId == 2">
        <div class="select-fun-title">智联后台准备中，完成选项，为您提供个性功能</div>
        <div class="fun-issue">您是代表？</div>
        <el-radio-group v-model="radio2" size="small">
          <template v-for="(item, index) in identity">
            <el-radio :label="index + 1" border :key="index">{{ item }}</el-radio>
          </template>
        </el-radio-group>

        <div class="fun-issue">您的产品用途是？</div>
        <el-radio-group v-model="radio3" size="small">
          <template v-for="(item, index) in productUse">
            <el-radio :label="index + 1" border :key="index">{{ item }}</el-radio>
          </template>
        </el-radio-group>
        <div style="text-align:center">
          <el-button type="primary" v-if="radio2 != 0 && radio3 != 0" @click="login">免费试用</el-button>
          <el-button type="primary" v-else disabled>免费试用</el-button>
        </div>
      </div>

      <div v-else class="select-function">
        <div class="select-fun-title">更多功能，智联小伙伴正在开发中，敬请期待！</div>
      </div>
    </div>
  </div>
</template>

<script>
import { login } from '@/api/user'
import { setToken } from '@/utils/auth'
import { initApply } from "@/api/apply";
export default {
  data() {
    return {
      selectId: "",
      radio2: 0,
      radio3: 0,
      loginInfor: {},
      hotPro: [
        {
          id: 1,
          imgUrl: require("@//static/style/tongchengxitong@2x.png")
        },
        {
          id: 2,
          imgUrl: require("@//static/style/huikeyuan@2x.png")
        },
        {
          id: 3,
          imgUrl: require("@//static/style/xifenhudong@2x.png")
        }
      ],
      retailData: [
        {
          id: 4,
          title: "微商城",
          hint: "小程序+公众号一体化微信上传",
          imgUrl: require("@//assets/config_images/weishangcheng.png")
        },
        {
          id: 5,
          title: "智慧零售",
          hint: "赋能线下门店，重构消费连接",
          imgUrl: require("@//assets/config_images/zhihuilingshou.png")
        }
      ],
      generalize: [
        {
          id: 6,
          title: "微站",
          hint: "强大的可视化装修系统，个性建站",
          imgUrl: require("@//assets/config_images/weizhan.png")
        },
        {
          id: 7,
          title: "智营销",
          hint: "全方位智能+营销解决方案",
          imgUrl: require("@//assets/config_images/zhiyingxiao.jpg")
        },
        {
          id: 8,
          title: "智联表单",
          hint: "功能强大的数据收集助手",
          imgUrl: require("@//assets/config_images/biaodan.png")
        }
      ],
      identity: ["企业", "组织机构", "个体户", "学生", "其他个人"],
      productUse: ["门店引流", "现场活动", "公众号吸粉", "电商引流", "品牌传播", "其他"],
      token: ""
    }
  },
  mounted() {
    this.loginInfor = this.$route.params.loginInfor
  },
  methods: {
    login() {
      login(this.loginInfor.mobile, this.loginInfor.password, "", 1).then(response => {
        const { data } = response
        this.token = data.app_token;
        this.$store.commit('user/SET_TOKEN', data.app_token)
        this.$store.commit('user/SET_NAME', data.username)
        this.$store.commit('user/SET_AVATAR', data.headimgurl)
        this.$store.commit('user/SET_STATUS', data.status)
        setToken(data.app_token)
        this.gomessage();
        // console.log(this.token)
      })
    },
    gomessage() {
      initApply(1).then(res => {
        if (res.code === 200) {
          location.href = "http://mobshop.58zltc.com?token=" + this.token + "&appid=" + res.data.app_id;
        }
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.newUserSelect {
  background: #f3f7f9;
  height: 100vh;
  overflow: auto;
  position: relative;

  .page-header {
    position: absolute;
    background: #fff;
    height: 70px;
    padding-top: 10px;
    width: 100%;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid #ececec;

    div:nth-child(1) {
      height: 20px;
      line-height: 20px;
      color: #3b94f2;
      font-size: 24px;
    }

    div:nth-child(2) {
      height: 40px;
      line-height: 40px;
      font-size: 14px;

      span {
        color: #eca82a;
      }
    }
  }

  .page-cont {
    position: absolute;
    top: 70px;
    width: 1000px;
    left: 50%;
    margin-left: -500px;
    min-height: 600px;

    .page-cont-hint {
      height: 70px;
      padding: 10px 0;
      padding-top: 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-around;

      div:nth-child(2) {
        color: #c4c7d0;
        font-size: 12px;
      }
    }

    .select-product {
      // background: #fafafa;
      padding: 0 25px;
      padding-bottom: 20px;

      .select-title {
        padding: 20px 0;
        color: #000;
        font-weight: bold;

        span {
          color: #cfd1d6;
          margin-left: 5px;
        }
      }

      .hot-cont {
        display: flex;
        justify-content: space-between;

        >div {
          width: 32%;
          height: 150px;
          border-radius: 10px;
          background: #fff;
          overflow: hidden;
          box-shadow: 0px 0px 5px 1px #e4e4e4;
          transition:all 0.5s;
          background-size: 100% 100%;
          position: relative;
        }

        .select-module {
          position: absolute;
          top: 5px;
          left: 5px;
          font-size: 24px;
        }

        >div:hover {
          margin-top: -10px;
          transition:all 0.5s;
        }

        .title-img {
          width: 100%;
          height: 100px;
          display: flex;

          >div {
            width: 40%;
            height: 100%;
            text-align: center;
            line-height: 100px;
            font-size: 24px;
            font-weight: bold;
            color: #fafafa;

            img {
              width: 90%;
              // height: 80%;
              vertical-align: middle;
            }
          }

          >div:nth-child(2) {
            width: 60%;
          }
        }

        .hot-option-hint {
          text-align: center;
          height: 50px;
          line-height: 50px;
          color: #fafafa;
        }
      }

      .commerce-retail {
        justify-content: flex-start;

        >div {
          margin-right: 20px;
        }

        .module-box {
          padding: 0 10px;
          .module-box-introduce {
            height: 95px;
            padding: 15px 15px 0 15px;

            .name {
              font-size: 20px;
              font-weight: bold;
              color: #595961;
              height: 50px;
              line-height: 50px;
              display: flex;
              align-items: center;
              justify-content: space-between;

              img {
                width: 35px;
                border-radius: 20px;
              }
            }

            .module-hint {
              color: #85868e;
              height: 30px;
              line-height: 30px;
            }

          }

          .module-button {
            padding: 0 15px;
          }

        }

      }

    }

    .select-function {
      margin-top: 20px;
      // background: #fafafa;
      padding: 10px 20px;

      .select-fun-title {
        height: 40px;
        line-height: 40px;
        text-align: center;
      }

      .fun-issue {
        padding: 15px 0;
      }

      .el-button {
        margin: 20px auto;
        margin-top: 40px;
        width: 200px;
      }
    }

  }

}
</style>
